import {Modal} from "ant-design-vue";
import {createVNode} from "vue";
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";

export default {
	error(message, callback) {
		Modal.error({
			title: '提示：',
			okText: '确定',
			content: message,
			onOk: () => {
				if (callback) {
					callback();
				}
			}
		})
	},
	confirm(message, okText, cancelText, okCallback, cancelCallback) {
		Modal.confirm({
			title: '提示',
			content: message,
			icon: createVNode(ExclamationCircleOutlined),
			maskClosable: false,
			okText: okText ? okText : '确定',
			cancelText: cancelText ? cancelText : '取消',
			onOk() {
				if (okCallback) {
					okCallback();
				}
			},
			onCancel() {
				if (cancelCallback) {
					cancelCallback();
				}
			}
		})
	}
}
